﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;

namespace xiaolanshu
{
    class Data
    {
        public static DataTable lipstick_data;
        public static SqlDataAdapter lipstick_adapter;
        public static SqlCommandBuilder lipstick_builder;


        public static void getLipData()
        {
            string sqlstr = "select * from lipstick_infomation";
            SqlConnection conn = SQLTools.conn;
            lipstick_adapter = new SqlDataAdapter(sqlstr, conn);
            lipstick_builder = new SqlCommandBuilder(lipstick_adapter);

            lipstick_data = new DataTable();
            lipstick_adapter.Fill(lipstick_data);

            lipstick_data.Columns.Add(new DataColumn("index", System.Type.GetType("System.Int32")));
        }

        public static void updateLipData()
        {
            lipstick_builder.GetUpdateCommand();
            lipstick_adapter.Update(lipstick_data);
            Console.WriteLine("Updated!");
        }
    }
}
